package httpfs

import "strings"

type HfsOptions struct {
	pathPrefix string // 打开文件时，自动填补 PathPrefix,  如 abc.js  ， 实际打开  ${PathPrefix}/abc.js
	indexName  string // 打开路径为/ 时， 自动替换为 indexName,  默认为 "index.html"
}

type HfsOption func(*HfsOptions)

func WithPathPrefix(s string) HfsOption {
	return func(opts *HfsOptions) {

		if !strings.HasSuffix(s, "/") {
			s = s + "/"
		}
		opts.pathPrefix = s
	}
}

func WithIndexFile(s string) HfsOption {
	return func(opts *HfsOptions) {
		opts.indexName = s
	}
}
